<template>
	<div id="app">
		<router-view />
	</div>
</template>
<script>
import { getUserInfo, getLoginPerson, GetCcmsUserInfo} from "@/api/common/common";
export default {
	name: "app",
	data() {
		return {
			interval: null
		};
	},
	methods: {
		// 通过rem实现  设定不同分辨率下 字体大小自适应
		setSize() {
			let _that = this;
			let html = document.documentElement;
			function setFont() {
				let cliWidth = html.clientWidth;
				//1920 是设计稿对应分辨率
				html.style.fontSize = _that.$font.convertFontSizeFo1920() * 100 + "px";
			}
			setFont();
			window.onresize = function () {
				setFont();
			};
		},
	},
	watch: {
		//登录后 保持Token活跃度
		"$store.getters.isLogin": {
			handler(val) {
				if (val) {
                    axios.defaults.headers.common["token"] = this.$store.state.user.token;
                    axios.defaults.headers.common["authorization"] = this.$store.state.user.token;
				} else {
					clearInterval(this.interval);
					axios.defaults.headers.common["token"] = null;
					axios.defaults.headers.common["authorization"] = null;
				}
			},
			immediate: true
		}
	},
	mounted() {
		this.setSize();
	},
};
</script>
